<?php

/**
 * Pedido form base class.
 *
 * @method Pedido getObject() Returns the current form's model object
 *
 * @package    MercaderDigital
 * @subpackage form
 * @author     Germán Figueredo
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasePedidoForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'            => new sfWidgetFormInputHidden(),
      'Fecha'         => new sfWidgetFormDate(),
      'Id_Estado'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Estado'), 'add_empty' => false)),
      'Id_EstadoPago' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('EstadoPago'), 'add_empty' => false)),
      'fechaEvento'   => new sfWidgetFormInputText(),
      'Evento'        => new sfWidgetFormInputText(),
      'id_user_ev'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('UsuarioEvento'), 'add_empty' => true)),
      'tipo'          => new sfWidgetFormInputText(),
      'Id_Comercio'   => new sfWidgetFormInputText(),
      'Id_Proveedor'  => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'            => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'Fecha'         => new sfValidatorDate(),
      'Id_Estado'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Estado'))),
      'Id_EstadoPago' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('EstadoPago'))),
      'fechaEvento'   => new sfValidatorPass(array('required' => false)),
      'Evento'        => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'id_user_ev'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('UsuarioEvento'), 'required' => false)),
      'tipo'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'Id_Comercio'   => new sfValidatorPass(array('required' => false)),
      'Id_Proveedor'  => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('pedido[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Pedido';
  }

}
